package com.taotao.rest;

import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPool;

public class testJedisSpring {
	
	ApplicationContext context;
	@Before
	public void before() {
		context=new ClassPathXmlApplicationContext("spring/applicationContext-jedis.xml");
	}
	
	@Test
	public void testSingle() {
		JedisPool pool = (JedisPool) context.getBean("jedisPool");
		Jedis resource = pool.getResource();
		String string = resource.get("a");
		System.out.println(string);
	}
	
	@Test
	public void testCluster() {
		JedisCluster cluster= (JedisCluster) context.getBean("jedisCluster");
		String string = cluster.get("a");
		System.out.println(string);
	}
}
